package com.test.action;

import com.opensymphony.xwork2.ActionContext;
import com.test.base.BaseAction;
import com.test.domain.Reply;
import com.test.domain.Topic;
/**
 * 发表回复
 * @author Administrator
 *
 */
public class ReplyAction extends BaseAction<Reply>{
	private static final long serialVersionUID = 1L;
	private Integer topicId;
	public String addUI(){
		Topic topic  = topicService.findTopicById(topicId);
		ActionContext.getContext().put("topic", topic);
		return "addUI";
	}
	public String add(){
		Topic topic  = topicService.findTopicById(topicId);
		Reply reply = new Reply();
		reply.setTopic(topic);
		reply.setContent(model.getContent());
		reply.setAuthor(getCurrentUser());
		reply.setIpAddress(getRequestIp());
		replyService.addReply(reply);
		return "toTopicShow";
	}
	
	
	
	public Integer getTopicId() {
		return topicId;
	}
	public void setTopicId(Integer topicId) {
		this.topicId = topicId;
	}
	
}
